Hack Name: Portal System Addon: Five Most Viewed Profiles v1.0

Author: WormHole @ XMB Garage

Last Updated: 05/21/2006

Description:
This hack will add a block to your portal that will display the 5 most viewed member profiles on your board.
This hack requires XMB Portal v2.4 and the Member Profile Views v1.0 to be installed before installing.

Supported Version: XMB 1.9.5 Nexus Final

Notes:

This hack is released under the GPL. You should have recieved a copy of it with this hack.

Please backup your files before installing this mod. Neither XMB Garage nor the author can be held 
responsible if your board stops functioning properly due to you installing this hack.

=======================================================================================================

=======
Step 1:
=======

===========================
Edit lang/English.portal.php:
===========================

=====
Find:
=====

?>

==========
Add Above:
==========

// Five Most Viewed Profiles Mod Begin
$lang['mostviewed'] = "Top 5 Most Viewed Profiles";
// Five Most Viewed Profiles Mod End

=======================================================================================================

=======
Step 2:
=======

================
Edit portal.php:
================

=====
Find:
=====

'portal_quick_reg'

============
Replace With:
============

'portal_quick_reg',
'portal_viewed'

=====
Find:
=====

$sql = $db->query("SELECT p.*, t.* FROM $table_portal_templates p LEFT JOIN $table_templates t ON t.name = p.name WHERE p.status = 'on' ORDER BY p.displayorder ASC  LIMIT 0 , 30");

==========
Add Above:
==========

// Five Most Viewed Profiles Mod Begin
$viewedmembers = array();
$viewedquery = $db->query("SELECT username, views FROM $table_members ORDER BY views DESC LIMIT 5");
while($viewed = $db->fetch_array($viewedquery)) {
    $viewedmembers[] = "<tr>\n<td class=\"tablerow\" bgcolor=\"$altbg2\"><a href=\"./member.php?action=viewpro&username=".rawurlencode($richest[username])."\">$viewed[username]</a></td><td class=\"tablerow\" bgcolor=\"$altbg1\">$viewed[views]</td>\n</tr>";
}
$viewedmembers = implode("\n", $viewedmembers);
// Five Most Viewed Profiles Mod End

=======================================================================================================

=======
Step 3:
=======

===========================================================
Go to Administration Panel -> Portal Admin -> Create Block: portal_viewed
===========================================================

====================
Add Code and Submit:
====================

<table cellspacing="0" cellpadding="0" border="0" width="100%" bgcolor="$bordercolor">
<tr>
<td>
<table border="0" cellspacing="$borderwidth" cellpadding="$tablespace" width="100%">
<tr>
<td class="category" colspan="2"><strong><font color="$cattext">&raquo; $lang[mostviewed]</font></strong></td>
$viewedmembers
</table>
</td>
</tr>
</table>

=======================================================================================================